package com.longcai.feign.factory;

import com.longcai.feign.client.TraFeignClient;
import com.longcai.feign.fallback.TraFeignClientFallbackImpl;
import com.longcai.feign.api.RemoteLogApi;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * fallbackFactory:表示调用服务出现问题时可以打印出相应日志
 *
 * @author Administrator
 * @Title: RemoteSysLogApiFallbackFactory
 * @ProjectName spring-cloud-media
 * @Description: TODO
 * @date 2019/2/1813:55
 */
@Component
public class TraFeignClientFallbackFactory implements FallbackFactory<TraFeignClient> {

    @Override
    public TraFeignClient create(Throwable throwable) {
        TraFeignClientFallbackImpl traFeignClientFallback = new TraFeignClientFallbackImpl();
        traFeignClientFallback.setThrowable(throwable);
        return traFeignClientFallback;
    }
}
